package com.tz.crm.components;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.stereotype.Component;

import javax.inject.Inject;

/**
 * 配置 事务管理器
 *
 * @author HuJingling
 * @since 2017/1/19
 */
@Component
public class MyHibernateTransactionManager extends HibernateTransactionManager {

    /**
     * 构造函数
     *
     * @param sessionFactory SessionFactory
     */
    @Inject
    public MyHibernateTransactionManager(SessionFactory sessionFactory) {
        logger.debug("HibernateTransactionManager init...");
        this.setSessionFactory(sessionFactory);
    }
}
